Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid login issue in deployment E2E tests #2065

Merged
merged 43 commits into from
Jan 1, 2025

Conversation

brandonpayton
Copy link
Member

@brandonpayton brandonpayton commented Dec 10, 2024

Motivation for the change, related issues

The deployment E2E tests are currently broken. WP admin email verification for an old WP 6.5 build appears to be causing a login failure error during the deployment tests.

An example of a failing screenshot comparison due to failed login is here.

Implementation details

This PR disables login to avoid problems with admin email verification on an old, pre-installed WP build.

Testing Instructions (or ideally a Blueprint)

  • CI

WP admin email verification for an old WP 6.5 build
appears to be causing a login failure error during the
deployment tests. We aren't testing login, so lets just
disable login for these tests.
@brandonpayton brandonpayton added [Type] Bug An existing feature does not function as intended [Package][@wp-playground] Website labels Dec 10, 2024
@brandonpayton brandonpayton requested a review from a team December 10, 2024 06:11
@brandonpayton brandonpayton self-assigned this Dec 10, 2024
This is necessary to continue using the same logged-in
screenshots for reference in the tests.
@brandonpayton
Copy link
Member Author

I'm not yet sure why CI continues to fail with these E2E tests. These changes seem to fix the testing issue when run locally with

npx nx e2e:playwright playground-website -- --ui

@adamziel
Copy link
Collaborator

Hm, nothing obvious stands out to me 🤔

@brandonpayton
Copy link
Member Author

Hm, nothing obvious stands out to me 🤔

Thanks for considering this, @adamziel.

Something strange is going on with the old version, but I don't think we need to understand why. Instead, I plan to just disable logins and update the old-version reference screenshots to match that.

How did you originally generate the screenshots to match what CI will create? My plan is to just use a temp commit to generate the screenshots as part of the tests and then save those, but maybe there is a faster or easier way.

Since I ran out of time this evening, I created #2071 to temporarily disable the tests before we can fix them properly.

@adamziel
Copy link
Collaborator

@brandonpayton I think I downloaded the CI artifacts and replaced the local screenshots – the CI runner had a different set of fonts than my mac so I couldn't easily use the ones generated locally.

brandonpayton and others added 12 commits December 31, 2024 16:04
## Motivation for the change, related issues

Adds a small "why" comment to WP_WXR_Reader about lazy init. I
originally had a question about this code, and the comment answers it.

## Testing Instructions (or ideally a Blueprint)

CI
Adds a basic `WP_HTML_To_Blocks` class that accepts HTML and outputs
block markup.

It's a very basic converter. It only considers the markup and won't
consider any visual changes introduced via CSS or JavaScript. Only a few
core blocks are supported in this initial PR. The API can easily support
more HTML elements and blocks.

To preserve visual fidelity between the original HTML page and the
produced block markup, we'll need an annotated HTML input produced by
the [Try WordPress](https://github.com/WordPress/try-wordpress/) browser
extension. It would contain each element's colors, sizes, etc. We cannot
possibly get all from just analyzing the HTML on the server without
building a full-blown, browser-like HTML renderer in PHP, and I know I'm
not building one.

A part of #1894

 ## Example

```php
$html = <<<HTML
<meta name="post_title" content="My first post">
<p>Hello <b>world</b>!</p>
HTML;

$converter = new WP_HTML_To_Blocks( $html );
$converter->convert();

var_dump( $converter->get_all_metadata() );
/*
 * array( 'post_title' => array( 'My first post' ) )
 */

var_dump( $converter->get_block_markup() );
/*
 * <!-- wp:paragraph -->
 * <p>Hello <b>world</b>!</p>
 * <!-- /wp:paragraph -->
 */
```

 ## Caveats

I had to patch WP_HTML_Processor to stop baling out on `<meta>` tags
referencing the document charset. Ideally we'd patch WordPress core to
stop baling out when the charset is UTF-8.

 ## Testing instructions

This PR mostly adds new code. Just confirm the unit tests pass in CI.

cc @brandonpayton @zaerl @sirreal @dmsnell @ellatrix
@brandonpayton brandonpayton force-pushed the fix-deployment-e2e-tests branch from ac42c84 to 5654edc Compare January 1, 2025 06:54
@brandonpayton
Copy link
Member Author

Thanks for your feedback on this, @adamziel.

The edge cases with the old version were gnarly. When I started using a Blueprint URL, we started seeing boot failures related a missing PHP 8.3 wasm in the old build. Thankfully, it turns out that we can use shorthand params to avoid login and apparently avoid that other error.

I updated the screenshots, and the tests are passing again. Time to merge this so more deployment tests are running again.

@brandonpayton brandonpayton merged commit 51f24e2 into trunk Jan 1, 2025
6 checks passed
@brandonpayton brandonpayton deleted the fix-deployment-e2e-tests branch January 1, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@wp-playground] Website [Type] Bug An existing feature does not function as intended
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants